package com.ruoyi.common.enums;

/**
 * 角色枚举
 */
public enum RoleEnum {
    //管理员
    ADMIN(1, "admin"),
    //错误
    NULL(0, "null");

    private int roleId;
    private String roleKey;

    RoleEnum(int roleId, String roleKey) {
        this.roleId = roleId;
        this.roleKey = roleKey;
    }

    public int getRoleId() {
        return roleId;
    }

    public String getRoleKey() {
        return roleKey;
    }

    public static RoleEnum match(int value) {
        for (RoleEnum one : RoleEnum.values()) {
            if (one.getRoleId() == value) {
                return one;
            }
        }
        return RoleEnum.NULL;
    }
}
